<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<link rel="stylesheet" type="text/css" href="/oa/Public/css/global.css" />
<link rel="stylesheet" type="text/css" href="/oa/Public/css/form.css" />
<script type="text/javascript" src="/oa/Public/js/jquery.js"></script>
<script type="text/javascript" src="/oa/Public/js/jquery.form.js"></script>
</head>
<body>
<div class="search">
<form action="" method="post" name="form1" id="form1" onsubmit="return checkform()">
<b>新建文件夹：</b><input type="text" name="name" >
<input type="hidden" name="tpl" value="<?php echo ($type); ?>">
<input type="submit" value="创建" title="创建新文件夹" class="submit">
</form>
</div>
<div class="list">
<?php if(is_array($data)): $i = 0; $__LIST__ = $data;if( count($__LIST__)==0 ) : echo "$empty" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><div class="folder"><span class="ico"></span><span class="foldername" onclick="lists(<?php echo ($vo["id"]); ?>)"><?php echo ($vo["name"]); ?></span><span style="float: right;padding-right:20px;" class="stripe"><a href="javascript:void(0);" onclick="del(<?php echo ($vo["id"]); ?>);">删除</a></span></div><?php endforeach; endif; else: echo "$empty" ;endif; ?>
</div>
</body>
<script type="text/javascript">
$(document).ready(function(){
	$(".submit").click(function(){
		var name = $("input[name='name']").val();
		var tpl = $("input[name='tpl']").val();
		$.post("/oa/index.php/Home/Database/add",{name:name,tpl:tpl},function(){
			location.reload();
		});
	});
});
function lists(id){
	window.location="/oa/index.php/Database/upload_list?id="+id+"&type=2";
}
function del(id){
	if(confirm("确定删除该文件夹？删除之后该文件夹下面的文件也将同时被删除，请谨慎操作！")){
		$.get("/oa/index.php/Database/folderdel?id="+id+"&type=2",function(result){
			location.reload();
		});
	}else{
		return false;
	}
}
function checkform(){
	var name = $("input[name='name']").val();
	if(name == ''){
		alert("请填写文件夹名称");return false;
	}
}
</script>
</html>